{{template "header.html" .}}
<div id="form-result-message">
    <div class="message success hide">链接已添加</div>
    <div class="message error hide">链接添加失败：<span></span></div>
</div>
<form id="link-add-form" class="form container" action="/admin/links/add" method="post">
    <div id="link-add-form-header">
        <h1 class="h1">添加友链</h1>
    </div>
    <div id="link-add-form-main">
        <p class="item">
            <label for="link-add-name">名称</label>
            <input id="link-add-name" class="ipt" type="text" name="title" required="required"/>
        </p>
        <p class="item">
            <label for="link-add-url">URL</label>
            <input id="link-add-url" class="ipt" type="url" name="url" required="required"/>
        </p>
        <p class="item clear">
            <label for="link-add-desc" class="left">描述</label>
            <textarea class="ipt left" name="desc" id="link-add-desc"></textarea>
        </p>
        <p class="item submit">
            <button class="btn save" id="link-add-submit" type="submit">保存链接</button>
        </p>
    </div>
</form>
<script type="text/javascript">
    $(document).ready(function () {
        ajaxForm("#link-add-form", function (json) {
            if (json.res) {
                setTimeout(function () {
                    window.location.href = "/admin/links/"
                }, 1000);
            }
        })
    });
</script>
</body>
</html>